import java.util.Arrays;

public class RowData {

    private int rowIndex;

    private CellData[] cellDatas = new CellData[0];

    public RowData(int rowIndex) {
        this.rowIndex = rowIndex;
    }

    public void addCell(CellData cellData) {
        int col = cellData.getPosCol();
        if (cellDatas.length <= col) {
            cellDatas = Arrays.copyOf(cellDatas, col + 1, CellData[].class);
        }
        cellDatas[col] = cellData;
    }

    public void printRow() {
        for (CellData cellData : cellDatas) {
            System.out.print(cellData);
        }
        System.out.println("");
    }

    public CellData[] getCellDatas() {
        return cellDatas;
    }
}
